package com.example.month11.dialog.dialog;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.example.recyclerview01.R;

public class DialogActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialog);

    }

    public void onclick(View view) {
        AlertDialog dialog = new AlertDialog.Builder(this)
                .setContentView(R.layout.dialog_comment_dialog)
                .setText(R.id.btn_go, "麻里麻里红")
                .fromBottom(true).fullWidth()
                .show();

        // dialog的点击事件
        final EditText commentEt = dialog.getView(R.id.et_input);
        // 弹框中，如果有ListView，RecyclerView，CheckBox等特有的对象，要用getView方法，先得到对象。然后再做操作。
        dialog.setOnClickListener(R.id.account_icon_weibo, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String input = commentEt.getText().toString();
                Toast.makeText(DialogActivity.this, "click weibo:" + input, Toast.LENGTH_LONG).show();
            }
        });

    }
}